{% extends "index.html" %}
{% import "post_macros.html" as post_macros %}

{% block title %}{{config.title}} - {{page.title}}{% endblock title %}

{% block content %}

{% if page.toc %}
<div class="post-toc" id="post-toc">
    <h2 class="post-toc-title">Contents</h2>
    <div class="post-toc-content always-active">
        <nav id="TableOfContents">
            <ul>
                {% for h1 in page.toc %}
                <li>
                    <a href="{{h1.permalink | safe}}" class="toc-link">{{ h1.title }}</a>
                    {% if h1.children %}
                    <ul>
                        {% for h2 in h1.children %}
                        <li>
                            <a href="{{h2.permalink | safe}}" class="toc-link">{{ h2.title }}</a>
                        </li>
                        {% endfor %}
                    </ul>
                    {% endif %}
                </li>
                {% endfor %}
            </ul>
        </nav>
    </div>
</div>
{% endif %}

<article class="post">
    {{ post_macros::title(page=page) }}
    <div class="post-content">
      {{ page.content | safe }}
    </div>

    {% block page_before_footer %}
    {% endblock page_before_footer %}

    <div class="post-footer">
        {% block page_footer %}
            {% if page.taxonomies.tags %}
                <div class="post-tags">
                    {% for tag in page.taxonomies.tags %}
                        <a href="{{ get_taxonomy_url(kind="tags", name=tag) }}">#{{ tag }}</a>
                    {% endfor %}
                </div>
            {% endif %}
            {% if page.lower or page.higher %}
                <div class="post-nav">
                    {% if page.lower %}
                        <a class="previous" href="{{ page.lower.permalink }}">‹ {{ page.lower.title }}</a>
                    {% endif %}
                    {% if page.higher %}
                        <a class="next" href="{{ page.higher.permalink }}">{{ page.higher.title }} ›</a>
                    {% endif %}
                </div>
            {% endif %}

        {% endblock page_footer %}

    </div>

    {% block page_after_footer %}
    {% endblock page_after_footer %}
</article>

{% endblock content %}

